package com.atguigu4.search_sort.exer3;

/**
 * @author NoobMaster69  * @date 2024/5/27 0027 星期一 16:35
 */
public class Maopao {
    public static void main(String[] args) {

        int[] arr = new int[]{34,54,3,2,65,7,34,5,76,34,67};

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + "\t");
        }

        //冒泡
        for (int j = 0; j< arr.length -1  ;j++) {
            for (int i = 0; i < arr.length - 1 -j; i++) {
                if(arr[i] > arr[i + 1]){
                    int temp = arr[i];
                    arr[i] = arr[i+1];
                    arr[i+1] = temp;
                }
            }
        }

        System.out.println();


        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + "\t");
        }
    }
}
